<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('dept', function (Blueprint $table) {
            $table->id()->comment('主键id');
            $table->string('name', 100)->comment('部门名称');
            $table->string('code', 100)->comment('部门编号');
            $table->unsignedBigInteger('parentId')->default(0)->comment('父部门ID');
            $table->integer('sort')->default(0)->comment('排序');
            $table->tinyInteger('status')->default(1)->comment('状态：0-禁用，1-启用!!');
            $table->timestamp('createTime')->nullable()->comment('创建时间（秒级时间戳）');
            $table->timestamp('updateTime')->nullable()->comment('更新时间（秒级时间戳）');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('dept');
    }
};
